#!/bin/sh
# \
exec tclsh $0 $@

set class [lindex $argv 0];

set f [glob entry*.log.*]

set sum 0;
set n 0;

foreach i $f {
  set tmp [exec cat $i | tail -n 12 | grep $class | sed -e {s/^(I) \.\.\. \([0-9\.][0-9\.]*\)\:.*$/\1/g}];
  set sum [expr {$sum + $tmp}];
  incr n;
}

puts [expr {$sum/$n}];
